<?php


class Crawl_sina_comments_from_phone_json_library  extends Crawl_sina_from_phone_json_library{


    function make_data($result = NULL) {
        $this->_ci->load->helper('my_common_helper');

    	$result = json_decode($result, true);

        $rs = array();

        if($result['ok'] == 1) {
            $rs['count'] = $result['total_number'];

            $comments = array();
            foreach($result['data'] as $comment) {

                // 给话题那儿用的,暂时只需要这3个字段
                $comments[] = array(
                    'user' => $comment['user']['screen_name'],
                    'text' => strip_tags($comment['text']),
                    'commented_at' => my_strtotime($comment['created_at']),
                );
            }
            $rs['data'] = $comments;
        }else{
            return false;
        }

        return $rs;
    }

    // 评论的ip
    function make_parameters() {

        $parameters['url'] = 'http://m.weibo.cn/api/comments/show?id='.$this->_ci->input->post('mid')
            .'&page='.intval($this->_ci->input->post('page'));
    	return $this->_parameters = $parameters;
    }


}
